/*********************************************************************************************
 *
 *					Function to compare two strings											 *
 *
 ********************************************************************************************/

#include "mystrings.h"

int to_lower (int c)				/* To convert the character to lower case  */
{
	if ( c >= 'A' && c <= 'Z')
		c = c+ ('a'-'A');

	return c ;
}


int mystrcasecmp (const char *str1, const char *str2)
{										/* procedure to check two strings ignoring the case */
	char c1,c2 ;						/* str1, str2 are two input strings */

	do {
		c1 = *str1++;
		c2 = *str2++;
		c1 = to_lower (c1);
		c2 = to_lower (c2);
		if ( c1 ==  '\0' && c2 == '\0')
			break;
	}while ( c1 == c2 ) ;

	return (int) (c1 - c2) ;				/* return the difference */

}

